package Meituan;

import com.carrotsearch.sizeof.RamUsageEstimator;

/**
 * 测试一个java对象大小
 *
 * @author: leiwenkang
 * @date: 2019/6/10
 * @time: 10:56
 */
public class Test31 {
    public static void main(String[] args) {

//        Map<Integer, String> map = Maps.newHashMap();
//        for (int i = 0; i < 4000; i++) {
//            map.put(200000500 + i, "http://p1.meituan.net/xianfu/21075cd4bff8b88abed3bd9e487e8d0497105.jpg@watermark=1&&object=L3NjYXJsZXR0LzhkYjkxOTg2N2VmNjI3ZDM0ZDFhOGZhYTQ2N2Y3OWYwMzM2MC5wbmc=" + i);
//        }
//        System.out.println(RamUsageEstimator.sizeOf(map) / 1024 / 1024 + "MB");

        String str = "{\"feedback_id\":\"e083fc70089c94458ed6cef3a1de02e0\",\"device_type\":\"0\",\"encrypt_type\":0,"
                + "\"muid\":\"4505d762356b6a192ddeed277320984e\",\"callback\":\"http://gd-api.ad.jiguang"
                + ".cn/v1/union-report/feedback/e083fc70089c94458ed6cef3a1de02e0\",\"ts\":1597161601,"
                + "\"android_id\":\"5cc2ab2691b09aedb19ef0ad080130cc\","
                + "\"imeis\":\"b759e0175781423ed6f6a6f58642eb7a\",\"mac\":\"c66bc49b838a0e9c9fe324422bde4a9e\","
                + "\"ip\":\"36.40.235.250\",\"ua\":\"\"}";


        System.out.println(RamUsageEstimator.sizeOf(str) + "B");
    }
}
